package cn.usian.controller;

import cn.usian.common.R;
import cn.usian.entity.Dish;
import cn.usian.entity.DishFlavor;
import cn.usian.service.DishFlavorService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("dishFlavor")
public class DishFlavorController {
    @Resource
    private DishFlavorService dishFlavorService;

    @PostMapping
public R adddishFlavor(@RequestBody DishFlavor dishFlavor, HttpServletRequest request){
    Long dishId=(Long) request.getSession().getAttribute("dishId");
    dishFlavor.setDishId(dishId);
    Long id=(Long) request.getSession().getAttribute("employee");
    dishFlavor.setCreateUser(id);
    dishFlavor.setUpdateUser(id);
    return dishFlavorService.adddishFlavor(dishFlavor);
}
}
